package com.llb666.shop.order.api.dto;

import com.llb666.shop.order.domain.entity.bo.SubmitOrderBo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

/**
 * 用于创建订单的dto对象.
 *
 * @author llb666
 */
@Data
@Schema(name = "SubmitOrderDto", description = "用于创建订单的dto对象")
public class SubmitOrderDto {

    @Schema(description = "用户Id")
    private String userId;

    @Schema(description = "商品规格Id")
    private String itemSpecIds;

    @Schema(description = "地址Id")
    private String addressId;

    @Schema(description = "支付方式")
    private Integer payMethod;

    @Schema(description = "买家留言")
    private String leftMsg;

    @Schema(description = "订单创建时用到的token")
    private String token;

    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {
        SubmitOrderDto.Converter INSTANCE = Mappers.getMapper(SubmitOrderDto.Converter.class);
        SubmitOrderBo dto2bo(SubmitOrderDto activity);
    }
}
